<template>
  <div>
    <a-card :bordered="false">
      <f-search-form @searchHandler="searchHandler">
        <f-search-form-item label="专业包代码" name="majorCode" slot="advanced"/>
        <f-search-form-item label="专业包名称" name="majorName"/>
        <f-search-form-item label="工程包代码" name="packageNo" slot="advanced"/>
        <f-search-form-item label="工程包名称" name="packageName"/>
      </f-search-form>
      <f-table ref="table" rowKey="materialPackage100Id" :columns="columns" :exportBtn="false"
               :multiple="false" :operator="operator" :params="queryParam" :api="api.package"
               handler="materialPackagePageListHandler">
         <span slot="action" slot-scope="text, record">
          <template>
             <a @click="$refs.bmpDetailsDrawer.showDrawer(record)">填报</a>
             <a-divider type="vertical"/>
             <a @click="$refs.reportDetailsDrawer.showDrawer(record)">查看履历</a>
          </template>
        </span>
      </f-table>
      <bmp-details-drawer ref="bmpDetailsDrawer"></bmp-details-drawer>
      <report-details-drawer ref="reportDetailsDrawer"></report-details-drawer>
    </a-card>
  </div>
</template>
<script>
  import api from './js/apiPackage'
  import bmpDetailsDrawer from './bmp_details_drawer'
  import reportDetailsDrawer from './report_details_drawer'

  export default {
    name: 'TableList',
    props: {
      detailsParams: {}
    },
    components: {
      reportDetailsDrawer,
      bmpDetailsDrawer
    },
    data() {
      let me = this
      //操作按钮
      let operator = []
      return {
        api: Object.assign(api, this.api),
        //列表初始化查询参数
        queryParam: {},
        // 表头
        columns: [
          {
            title: '序号',
            width: 80,
            align: 'center',
            customRender: (text, record, index) => index + 1
          },
          {
            title: '项目代码',
            width: 300,
            align: 'center',
            dataIndex: 'projectCode'
          },
          {
            title: '项目名称',
            width: 300,
            align: 'center',
            dataIndex: 'projectName'
          },
          {
            title: '工程包代码',
            width: 300,
            align: 'center',
            dataIndex: 'packageNo'
          },
          {
            title: '专业代码',
            width: 300,
            align: 'center',
            dataIndex: 'majorCode'
          },
          {
            title: '操作',
            align: 'center',
            width: 300,
            scopedSlots: { customRender: 'action' }
          }
        ],
        operator: operator
      }
    },
    created() {
      this.queryParam = this.detailsParams
    },
    methods: {}
  }
</script>
